j3deditor.bin.hierarchy
Class J3DeLight

java.lang.Object
  extended by j3deditor.bin.hierarchy.HierarchyNode
      extended by j3deditor.bin.hierarchy.J3DeObject
          extended by j3deditor.bin.hierarchy.J3DeLight
All Implemented Interfaces:
Copyable, Cuttable, Deletable

public class J3DeLight
extends J3DeObject

Contains and manages an instance of javax.media.j3d.Light.

Author:
Risto Seene
See Also:
Light

Constructor Summary
J3DeLight()
          Creates an empty J3DeLight object.
J3DeLight(LightType type)
          Creates an instance of J3DeLight with the given type.
 
Method Summary
 HierarchyNode clone(HierarchyNode node)
          Clones this node.
 int[] getAttenuation()
          Returns the attenuation values of the Light object if this is pointlight.
 float[] getBoundsPosition()
          Returns the coordinates of the center of BoundingSphere.
 float getBoundsRadius()
          Returns the radius of BoundingSphere.
 java.awt.Color getColor()
          Returns the color of the Light object.
 int getConcentration()
          Returns the concentration value of this Light object if this is spotlight.
 boolean getEnable()
          Tests if the Light object is enabled.
 int getLightType()
          Returns the type of this light.
 int getSpreadAngle()
          Returns the spread angle of this Light object if this is spotlight.
 void init3DObject(javax.media.j3d.Node obj)
          Applies the given Node object to this node.
 void setAttenuation(int constant, int linear, int quadratic)
          Sets the attenuation values of the Light object if this is pointlight.
 void setBoundsPosition(float x, float y, float z)
          Sets the coordinates of the center of BoundingSphere.
 void setBoundsRadius(float radius)
          Sets the radius of BoundingSphere.
 void setColor(java.awt.Color color)
          Sets the color of this light.
 void setConcentration(int conc)
          Sets the concentration value of the Light object if this is spotlight.
 void setEnable(boolean state)
          Passes the given state to the Light object.
 void setSpreadAngle(int spread)
          Sets the spread angle of the Light object if this is spotlight.
 
Methods inherited from class j3deditor.bin.hierarchy.J3DeObject
delete, get3DObject, getObject, getRotationZ, getRotationX, getRotationY, getScaleZ, getScaleX, getScaleY, getTranslationZ, getTranslationX, getTranslationY, initObject, rotate, rotateZ, rotateX, rotateY, scale, scaleAll, scaleZ, scaleX, scaleY, setNode, setObject, translate, translateZ, translateX, translateY
 
Methods inherited from class j3deditor.bin.hierarchy.HierarchyNode
equals, getChild, getIndex, getIndexOfChild, getNumberOfChildren, getParent, getParent, getType, hasNamedChild, removeChild, setName, setParent, toString, updateName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

J3DeLight

public J3DeLight()
Creates an empty J3DeLight object. Requires initialization with init3DObject() method


J3DeLight

public J3DeLight(LightType type)
Creates an instance of J3DeLight with the given type.

Parameters:
type - the type of the light
Method Detail

init3DObject

public void init3DObject(javax.media.j3d.Node obj)
Applies the given Node object to this node.

Parameters:
obj - object to be applied to this node

clone

public HierarchyNode clone(HierarchyNode node)
Clones this node.

Overrides:
clone in class J3DeObject
Parameters:
node - object sent by subclass, otherwise null
Returns:
Returns the clone of this node

getLightType

public int getLightType()
Returns the type of this light.

Returns:
Returns the type of this light

getEnable

public boolean getEnable()
Tests if the Light object is enabled.

Returns:
Returns true if Light is enabled, otherwise false
See Also:
Light.getEnable()

setEnable

public void setEnable(boolean state)
Passes the given state to the Light object.

Parameters:
state - true if light is enabled, otherwise false
See Also:
Light.setEnable(boolean state)

getColor

public java.awt.Color getColor()
Returns the color of the Light object.

Returns:
Returns the color of this light
See Also:
Light.getColor(Color3f color)

setColor

public void setColor(java.awt.Color color)
Sets the color of this light.

Parameters:
color - new color
See Also:
Light.setColor(Color3f color)

getAttenuation

public int[] getAttenuation()
Returns the attenuation values of the Light object if this is pointlight.

Returns:
Returns a 3 element array of attenuation values, if this is not pointlight all values are 0
See Also:
PointLight.getAttenuation(Point3f a)

setAttenuation

public void setAttenuation(int constant,
                           int linear,
                           int quadratic)
Sets the attenuation values of the Light object if this is pointlight.

Parameters:
constant - value of constant attenuation
linear - value of linear attenuation
quadratic - value of quadratic attenuation
See Also:
PointLight.setAttenuation(float c, float l, float q)

getConcentration

public int getConcentration()
Returns the concentration value of this Light object if this is spotlight.

Returns:
Returns the concentration value, if this is not spotlight returns 0
See Also:
SpotLight.getConcentration()

setConcentration

public void setConcentration(int conc)
Sets the concentration value of the Light object if this is spotlight.

Parameters:
conc - value of concentration
See Also:
SpotLight.setConcentration(float c)

getSpreadAngle

public int getSpreadAngle()
Returns the spread angle of this Light object if this is spotlight.

Returns:
Returns the spread angle, if this is not spotlight returns 0
See Also:
SpotLight.getSpreadAngle()

setSpreadAngle

public void setSpreadAngle(int spread)
Sets the spread angle of the Light object if this is spotlight.

Parameters:
spread - spread angle
See Also:
SpotLight.setSpreadAngle(float a)

getBoundsRadius

public float getBoundsRadius()
Returns the radius of BoundingSphere.

Returns:
Returns the radius of BoundingSphere

setBoundsRadius

public void setBoundsRadius(float radius)
Sets the radius of BoundingSphere.

Parameters:
radius - new radius

getBoundsPosition

public float[] getBoundsPosition()
Returns the coordinates of the center of BoundingSphere.

Returns:
Returns the center coordinates as an array

setBoundsPosition

public void setBoundsPosition(float x,
                              float y,
                              float z)
Sets the coordinates of the center of BoundingSphere.

Parameters:
x - coordinate on X-axis
y - coordinate on Y-axis
z - coordinate on Z-axis